﻿
using JunionRobotTaskManager.Models;
using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JunionRobotTaskManager.Repository
{
    public class RobotRepository : BaseRepository<Robot>, IRobotRepository
    {
        public RobotRepository(ISqlSugarClient context) : base(context)
        {
            base.Context = context;
        }

        public List<Robot> QueryRelated()
        {
            return  base.AsQueryable().
                Mapper(t => t.CurrentJob, t => t.JobId).

                ToList();
        }

        public async Task<List<Robot>> QueryRelatedAsync()
        {
            return await base.AsQueryable().
                Mapper(t => t.CurrentJob, t => t.JobId).

                ToListAsync();
        }
    }
}
